import { IFeidaoAiNodejsComponent } from '@dfeidao/atom-nodejs/interfaces';
import nodejs from '@dfeidao/atom-nodejs/msg/nodejs';
import render from '@dfeidao/atom-nodejs/render/render';
import { systemid } from '../../atom/config';
import p001 from './p001';
import p002 from './p002';
export default async function na001(fd: IFeidaoAiNodejsComponent) {
	const no = fd.data.params['page-no'] as string;
	let pno = parseInt(no, 10);
	console.log(pno);
	if (!pno) {
		pno = 1;
	}
	const res = await nodejs<{ res: Array<{}>; ress: number }>(fd.data.actionid,
		fd.data.sessionid, 'train-plan/zj-000002/s001', {
			filter: {
				id: ''
			},
			page_no: pno
		});
	console.log(res);
	render(fd.data.node, res.res, p001, 'p001');
	render(fd.data.node, { page_no: pno, total: res.ress }, p002, 'p002');

}
